Crate vk_alloc[][src]

Expand description

A segregated list memory allocator for Vulkan.

The allocator can pool allocations of a user defined lifetime together to help reducing the fragmentation.

Example:

#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
enum Lifetime {
    Buffer,
    Image,
}

impl vk_alloc::Lifetime for Lifetime {}

Allocator::<Lifetime>::new(
    &instance,
    &physical_device,
    &AllocatorDescriptor {
        ..Default::default()
    },
).unwrap();

let allocation = alloc
    .allocate(
        &logical_device,
        &AllocationDescriptor {
            location: MemoryLocation::GpuOnly,
            requirements: vk::MemoryRequirementsBuilder::new()
                .alignment(512)
                .size(1024)
                .memory_type_bits(u32::MAX)
                .build(),
            lifetime: Lifetime::Buffer,
            is_dedicated: false,
            is_optimal: false,
        },
    )
    .unwrap();

Structs

An allocation of the Allocator.

The descriptor for an allocation on the allocator.

The general purpose memory allocator. Implemented as a segregated list allocator.

Describes the configuration of an Allocator.

Enums

Errors that the allocators can throw.

The intended location of the memory.

Traits

The lifetime of an allocation. Used to pool allocations and reduce fragmentation.